﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PluggableModulesInterface;
using Utils;
using StorageManagement;
using AlertSystem.Business;

namespace AlertSystem.UI
{
    public static class StaticThreadManage
    {
        public static bool Running { get; private set; }
        static ReaderThreadManage _readerThread = new ReaderThreadManage();
        static TrackingService _trakingSevice = new TrackingService();
        public static void Start()
        {
            try
            {
                _readerThread.Start();
                _trakingSevice.Start();
                Running = true;
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static void Stop()
        {
            try
            {
                _readerThread.Stop();
                _trakingSevice.Stop();
                Running = false;
            }
            catch (Exception)
            {
                throw;
            }
        }

        public static void Exit()
        {
            try
            {
                //Dừng luồng đọc dữ liệu
                Stop();
                //Dừng tất cả các plugable module
                PluggableManage.Stop();
            }
            catch (Exception)
            {
                throw;
            }
        }
    }
}
